#pragma once
#include<iostream>
#include<string>
#include<fstream>

class Util
{
public:
    static std::string getOneLine(std::string& buffer,const std::string sep)
    {
        auto pos = buffer.find(sep);
        if(pos == std::string::npos) return "";
        std::string oneline = buffer.substr(0,pos);
        buffer.erase(0,oneline.size()+sep.size());//去除第一行+/r/n
        return oneline;
    }
    static bool readfile(const std::string& resourse,char *buffer,int size)
    {
        std::ifstream in(resourse,std::ios::binary);
        if(!in.is_open()) return false;


        in.read(buffer,size);
        // std::string line;
        // while(std::getline(in,line))
        // {
        //     *out += line;
        // }

        in.close();
        return true;
    }

};
